// 提供商品相关的API函数

import request from '@/utils/request'

/**
 * 获取商品详情
 * @param {String} id -商品的id
 */
export const findGoods = (id) => {
    return request('/goods', 'get', { id })
}

/**
 * 获取相关推荐的商品 猜你喜欢
 * @param {String} id - 商品id 传入相关推荐，不传猜你喜欢 
 * @param {*} limit -商品数量
 */
export const findRelevantGoods = (id, limit = 16) => {
        return request('/goods/relevant', 'get', { id, limit })
    }
    /**
     * 
     * @param {String} id - 商品id 
     * @param {Integer} limit -商品数量
     * @param {Integer} type -热销类型
     */
export const findGoodsHot = ({ id, limit = 3, type = 1 }) => {
        return request('/goods/hot', 'get', { id, limit, type })

    }
    /**
     * 
     * @param {String} id - 商品id 
     * @returns 
     */
export const findGoodsCommentInfo = (id) => {
        return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate`, 'get')
    }
    /**
     * 
     * @param {String} id 
     * @param {Object} params 
     * @returns 
     */
export const findGoodsCommentList = (id, params) => {
    return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate/page`, 'get', params)
}